package com.muyu.day2zy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.muyu.day2zy.mapper.PeopleMapper;
import com.muyu.day2zy.pojo.People;
import com.muyu.day2zy.pojo.vo.PeopleVo;
import com.muyu.day2zy.service.PeopleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName PeopleServiceImpl
 * @Description 描述
 * @Author ShiYu.Cui
 * @Date 2024/3/23 7:59
 */
@Service
public class PeopleServiceImpl implements PeopleService {
    @Autowired
    private PeopleMapper peopelMapper;

    @Override
    public List<People> list(PeopleVo peopleVo) {
        long startTime = System.currentTimeMillis();
        PageHelper.startPage(peopleVo.getPageNum(),peopleVo.getPageSize());
        List<People> list=peopelMapper.list();
        PageInfo<People> of = PageInfo.of(list);
        long endTime = System.currentTimeMillis();
        System.out.println("查询时间"+(endTime-startTime)+"ms");
        return of.getList();
    }
}
